package  de.tum.softwarengineering1.ws201112.team11.sudoku.model;

import de.tum.softwarengineering1.ws201112.team11.sudoku.logic.RandomizedSolver;

/**
 * PrioCell class.
 * 
 * @author Dhyan
 * 
 */
public class PrioCell extends Cell implements Comparable<PrioCell> {
    /**
     * Higher priority means the cell value is less likely to be replaced by a
     * new random value
     */
    private long priority = 0L;

    public PrioCell(final int row, final int col) {
	super(row, col);
	setRandomPriority();
    }

    public PrioCell(final int row, final int col, final int val) {
	super(row, col, val);
    }

    public final void setRandomPriority() {
	priority = RandomizedSolver.getRandomInt(0, 9);
    }

    @Override
    public int compareTo(final PrioCell other) {
	if (this.priority < other.priority) {
	    return -1; // Towards head
	} else {
	    return 1; // Towards end
	}
    }

    public void increasePriority(final int amount) {
	this.priority += amount;
    }
}
